package com.zbkj.dal.pojo.response;

import com.zbkj.dal.entity.user.UserAddress;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

@Data
@ApiModel("用户地址")
public class UserAddressVO {

    @ApiModelProperty(value = "收货人姓名")
    private String realName;

    @ApiModelProperty(value = "收货人电话")
    private String phone;

    @ApiModelProperty(value = "收货人所在省")
    private String province;

    @ApiModelProperty(value = "收货人所在市")
    private String city;

    @ApiModelProperty(value = "收货人所在区/县")
    private String district;

    @ApiModelProperty(value = "收货人详细地址")
    private String detail;

    @ApiModelProperty(value = "全地址")
    public String getFullAddress() {
        return province + city + district + detail;
    }


    public static UserAddressVO buildByUserAddress(UserAddress userAddress) {
        UserAddressVO userAddressVO = new UserAddressVO();
        userAddressVO.setRealName(userAddress.getRealName());
        userAddressVO.setPhone(userAddress.getPhone());
        userAddressVO.setProvince(userAddress.getProvince());
        userAddressVO.setCity(userAddress.getCity());
        userAddressVO.setDistrict(userAddress.getDistrict());
        userAddressVO.setDetail(userAddress.getDetail());
        return userAddressVO;
    }
}
